package com.yuwei.notice.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.base.BaseViewModel
import com.yuwei.http.ApiService
import com.yuwei.http.entity.NoticeEntity
import com.yuwei.http.entity.NoticeEntityItem
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class NoticeViewModel @Inject constructor(
    val apiService: ApiService
): BaseViewModel(){
    val getNoticeSuccess by lazy { MutableLiveData<NoticeEntity>() }
    fun getNotice(userId : Int){
        viewModelScope.launch {
            executeNetwork({
                apiService.getNoticeByUserId(userId)
            },getNoticeSuccess::postValue)
        }
    }
}